/**
 * Created by 从小就坏
 * Created on 2017/4/25 0025.
 */

define(['vue'], function (Vue) {
    return{
        login: function (phoneNum, pwd) {
            return Vue.http.post('/login', {phoneNum: phoneNum, pwd: pwd})
                .then(function (response) {
                    return (response.json())
                }).then(function(json){
                    if(json.success){
                        return json.success
                    } else {
                        if(json.error){
                            alert(json.error)
                            return null
                        } else {
                            return json.data
                        }
                    }
                })
        }
    }
})